// 业务派单接口
import request from '@/utils/request'
import { commonBaseUrl } from '@/utils'

const moduleName = commonBaseUrl('B')
const moduleNameThree = commonBaseUrl('A')

// 业务派单获取table信息(项目操作)
export function getProjectInfo(params) {
    return request({
        url: moduleName + 'tDispatchInfo/getProjectInfo',
        showLoading: true,
        params,
        method: 'get'
    })
}

// 业务派单获取form信息(已办)
export function getTDispatchInfoById(params) {
    return request({
        url: moduleName + 'tDispatchInfo/getTDispatchInfoById',
        showLoading: true,
        params,
        method: 'get'
    })
}
// 业务派单获取table信息(已办)
export function getTDispatchProjectById(params) {
    return request({
        url: moduleName + 'tDispatchInfo/getTDispatchProjectById',
        showLoading: true,
        params,
        method: 'get'
    })
}

// 查看是否转派为是的时候(已办)
export function getTransferRecord(params) {
    return request({
        url: moduleName + 'tDispatchInfo/getTransferRecord',
        showLoading: true,
        params,
        method: 'get'
    })
}

// 接单人员选重新派单(已办)
export function creatDispatchProjectFlow(data) {
    return request({
        url: moduleName + 'tDispatchInfo/creatDispatchProjectFlow',
        showLoading: true,
        data,
        method: 'post'
    })
}

// 派单项目列表确认接口
export function insertTDispatchInfo(data) {
    return request({
        url: moduleName + 'tDispatchInfo/insertTDispatchInfo',
        showLoading: true,
        data,
        method: 'post'
    })
}

// 项目操作- 选择人员查询('prjId' == 内部人员)
export function getSendStaffTree(params) {
    return request({
        url: moduleName + 'tDispatchInfo/getSendStaffTree',
        showLoading: true,
        params,
        method: 'get'
    })
}

// 项目操作- 选择人员查询('prjId' == 服务商)
export function getServicerSendStaffTree(params) {
    return request({
        url: moduleName + 'tDispatchInfo/getServicerSendStaffTree',
        showLoading: true,
        params,
        method: 'get'
    })
}

// 项目操作- 基本信息('prjId')
export function getProjectInfoByPrjId(params) {
    return request({
        url: moduleName + 'tDispatchInfo/getProjectInfoByPrjId',
        showLoading: true,
        params,
        method: 'get'
    })
}

// 我的待办- 基本信息('workItemId')
export function getOrderTakingInfo(params) {
    return request({
        url: moduleName + 'tDispatchInfo/getOrderTakingInfo',
        showLoading: true,
        params,
        method: 'get'
    })
}

// 我的待办- 保存
export function submitTDispatchFlow(data) {
    return request({
        url: moduleName + 'tDispatchInfo/submitTDispatchFlow',
        showLoading: true,
        data,
        method: 'post'
    })
}

// 我的待办- 获取workItemId信息
export function getWFWorkItem(params) {
    return request({
        url: moduleName + 'tfinInfo/getWFWorkItem',
        method: 'get',
        params
    })
}

export function getTDispatchList(data) {
    return request({
        url: moduleName + 'tDispatchInfo/getTDispatchInfoList',
        method: 'post',
        data
    })
}

// 结算导出清单
export function dispatchAsyncExport(data) {
    return request({
        url: moduleName + 'api/dispatch/export/dispatchAsyncExport',
        showLoading: true,
        method: 'post',
        data
    })
}

// 决算: 获取财务token(登录信息)接口 // 确认
export function applyTokenByCode(params) {
    return request({
        url: moduleName + 'api/platform/apply4ATokenByCode',
        method: 'get',
        params,
        showLoading: true
    })
}
// 获取外链接口
export function getForeignConfig(params) {
    return request({
        url: moduleName + 'tDispatchInfo/getForeignConfig',
        method: 'get',
        params
    })
}

// 决算: 获取用户信息接口
export function getUserInfo(params) {
    return request({
        url: moduleName + 'api/platform/getUserInfo', // 斜杠
        method: 'get',
        params
    })
}

// 决算: 获取用户信息接口
export function transferTokenPost(params) {
    return request({
        url: moduleName + 'api/platform/transferTokenPost', // 斜杠
        method: 'post',
        params
    })
}

export function commonUpload(data) {
    return request({
        url: moduleNameThree + 'api/attachment/file/commonUpload', // 斜杠
        method: 'post',
        data,
        hideMessage: true // 隐藏消息提示
    })
}
